/*
 */

package com.railway.notice.dao.impl;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import cn.org.rapid_framework.page.Page;

import com.railway.common.base.BaseIbatisDao;
import com.railway.common.base.IdGenerator;
import com.railway.notice.dao.INoticeDao;
import com.railway.notice.model.Notice;
import com.railway.notice.vo.NoticeQuery;



/**
 * @author  jiangcheng
 * @version 1.0
 * @since 1.0
 */




@Repository("noticeDao")
public class NoticeDaoImpl extends BaseIbatisDao<Notice,java.lang.String> implements INoticeDao{
	
	@Override
	public String getIbatisSqlMapNamespace() {
		return "Notice";
	}
	
	public Notice getById(java.lang.String id){
		return super.getById( id);
	}
	
	public void deleteById(java.lang.String id){
		super.deleteById(id);
	}
	
	/** 插入数据 */
	public void save(Notice entity){
		if(StringUtils.isEmpty(entity.getId())) {
			entity.setId(IdGenerator.genUUIDStr());
		}
		super.save(entity);
	}
	
	/** 更新数据 */
	public void update(Notice entity){
		super.update(entity);
	}

	public boolean isUnique(Notice entity, String uniquePropertyNames){
		return super.isUnique( entity, uniquePropertyNames);
	}
	
	public List<Notice> findAll(){
		return super.findAll();
	}
	
	public void saveOrUpdate(Notice entity) {
		if(StringUtils.isEmpty(entity.getId())) {
			entity.setId(IdGenerator.genUUIDStr());
			super.save(entity);
		}
		else 
			super.update(entity);
	}
	
	public Page findPage(NoticeQuery query) {
		return pageQuery("Notice.findPage",query);
	}
	
}
